import { BASIC_FLAG } from "./enum"

/**
 * @description 设置启用禁用
 */
export const statusName = (status) => {
  switch (status) {
    case 0:
      return "启用"
    case 1:
      return "禁用"
  }
}

/**
 * @description 设置保存提交
 */
export const statusName2 = (status) => {
  switch (status) {
    case 0:
      return "保存"
    case 1:
      return "提交"
  }
}

/**
 * @description 设置弹框标题
 */

export const setDialogStatusName = (status) => {
  const { REMOVE, SUBMIT, ENABLE, DISABLE } = BASIC_FLAG
  switch (status) {
    case REMOVE:
      return "删除"
    case SUBMIT:
      return "提交"
    case ENABLE:
      return "启用"
    case DISABLE:
      return "禁用"
  }
}

/**
 * @description 新增页面标题
 */
export const setAddTitle = (status, title) => {
  const { ADD, EDIT, PARTICULAR } = BASIC_FLAG
  let newTitle = ""
  switch (status) {
    case ADD:
      newTitle = "新增" + title
      break
    case EDIT:
      newTitle = "编辑" + title
      break
    case PARTICULAR:
      newTitle = title + "详情"
      break
  }
  uni.setNavigationBarTitle({
    title: newTitle
  })
  return newTitle
}
